package com.itfly.service;

import com.itfly.entity.EventCategories;
import com.itfly.entity.EventManagement;
import com.itfly.mapper.EventManagementMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EventManagementService {

    @Autowired
    private EventManagementMapper eventManagementMapper;
    //当前用户的事件
    public List<EventManagement> findEventById(Integer id) {
        List<EventManagement> eventManagements = eventManagementMapper.selectById(id);
        return eventManagements;
    }

    public List<EventManagement> findAll() {
        return eventManagementMapper.selectAll();
    }
    //添加事件
    public int insertEvent(EventManagement eventManagement) {
        return eventManagementMapper.insert(eventManagement);
    }

    public List<EventManagement> selectById(Integer id) {
        return eventManagementMapper.selectById(id);
    }
    //事件id
    public EventManagement selectByEventId(Integer eventId) {
        return eventManagementMapper.selectByEventId(eventId);
    }

    //删除
    public void deleteById(Integer id) {
        eventManagementMapper.deleteByPrimaryKey(id);
    }
    //根据categoryId查询
    public List<EventManagement> selectByCategoryId(Integer categoryId) {
        return eventManagementMapper.selectByCategoryId(categoryId);
    }
    //更新
    public void updateCategory(EventManagement eventManagement) {
        eventManagementMapper.updateByPrimaryKey(eventManagement);
    }
    //模糊查询
    public List<EventManagement> selectByLike(EventManagement eventManagement) {
        return eventManagementMapper.selectByLike(eventManagement);
    }
}
